5fab5510319a09b416068729f988a90ae013ef6b,ikasaneip/wiretap/src/test/java/org/ikasan/history/dao/HibernateMessageHistoryDaoTest.java,HibernateMessageHistoryDaoTest,setup,#,83

Before Change


    public void setup()
    {
    	
        MessageHistoryFlowEvent event1 = new MessageHistoryFlowEvent("moduleName", "flowName", "componentName",
                "lifeId", "relatedLifeId", "lifeId", "relatedLifeId",
                System.currentTimeMillis()-500L, System.currentTimeMillis(), System.currentTimeMillis()-1000000000L);

        event1.setHarvested(true);
        Set<CustomMetric> metrics = new HashSet<CustomMetric>();
        
        for(int i=0; i<6; i++)
        {
        	CustomMetric cm = new CustomMetric("name", "value");
        	cm.setMessageHistoryFlowEvent(event1);
        	metrics.add(cm);
        }
        
        event1.setMetrics(metrics);

        MetricEvent wiretapEvent = new MetricEvent("moduleName", "flowName", "componentName",
                "lifeId", "relatedLifeId", System.currentTimeMillis(), "payload", 30L);

        messageHistoryDao.save(wiretapEvent);
        messageHistoryDao.save(event1);

    }

After Change


    @Before
    public void setup()
    {
        Set<MessageHistoryFlowEvent> events = new HashSet<MessageHistoryFlowEvent>();

        for(int j=0; j<5; j++)
        {
            MessageHistoryFlowEvent event1 = new MessageHistoryFlowEvent("componentName",
                    "lifeId" + j, "relatedLifeId" + j, "lifeId" + j, "relatedLifeId" + j,
                    System.currentTimeMillis() - 500L, System.currentTimeMillis());

            Set<CustomMetric> metrics = new HashSet<CustomMetric>();

            for(int i=0; i<6; i++)
            {
                CustomMetric cm = new CustomMetric("name", "value");
                cm.setMessageHistoryFlowEvent(event1);
                metrics.add(cm);
            }

            event1.setMetrics(metrics);

            MetricEvent wiretapEvent = new MetricEvent("moduleName", "flowName", "componentName",
                    "lifeId" + j, "relatedLifeId" + j, System.currentTimeMillis(), "payload", 30L);

            messageHistoryDao.save(wiretapEvent);

            events.add(event1);
        }

        FlowInvocation<MessageHistoryFlowEvent> flowInvocation = new FlowInvocationImpl("moduleName", "flowName",
                System.currentTimeMillis()-500L, System.currentTimeMillis(), "ACTION", events, 0l);

        flowInvocation.setHarvested(true);


        messageHistoryDao.save(flowInvocation);

    }